package tree;

import java.util.List;

import datastructure.binarytree.TreeNode;

public class TreeGenerator {
    public static TreeNode preOrderRecover(List<String> treeValues) {
        String v = treeValues.remove(0);
        if ("null".equals(v)) {
            return null;
        }
        TreeNode root = new TreeNode(Integer.parseInt(v));
        root.left = preOrderRecover(treeValues);
        root.right = preOrderRecover(treeValues);
        return root;
    }
}
